package entities;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table (name= "planesProduccion")
public class PlanProduccionEntity implements Serializable {
	
	@Transient
	private static final long serialVersionUID = 1L;
	
	@Id @GeneratedValue
	private Integer id;
	@OneToMany (cascade = CascadeType.ALL)
	@JoinColumn (name= "idPlanProduccion")
	private List<ItemPlanProduccionEntity> itemPlan = new ArrayList<ItemPlanProduccionEntity>();

	
	public PlanProduccionEntity() {
	}

	
	
	public Integer getIdPlanProduccion() {
		return id;
	}
	public void setIdPlanProduccion(Integer idplanproduccion) {
		this.id = idplanproduccion;
	}
	public List<ItemPlanProduccionEntity> getItemplan() {
		return itemPlan;
	}
	public void setItemPlan(List<ItemPlanProduccionEntity> itemplan) {
		this.itemPlan = itemplan;
	}



	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result
				+ ((itemPlan == null) ? 0 : itemPlan.hashCode());
		return result;
	}



	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PlanProduccionEntity other = (PlanProduccionEntity) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (itemPlan == null) {
			if (other.itemPlan != null)
				return false;
		} else if (!itemPlan.equals(other.itemPlan))
			return false;
		return true;
	}
	
	
}
